//
//  YuanXinTrackModel.m
//  YuanXinTrack
//
//  Created by GJS on 2018/5/10.
//  Copyright © 2018年 GJS. All rights reserved.
//

#import "YuanXinTrackModel.h"

@implementation YuanXinTrackModel

- (instancetype)init
{
    self = [super init];
    if (self) {
        //
    }
    return self;
}

- (NSString *)ID {
    if (!_ID) {
        _ID = self.uuid;
    }
    
    return _ID;
}

- (NSDate *)loginTime {
    if (!_loginTime) {
        _loginTime = [NSDate date];
    }
    
    return _loginTime;
}

- (NSDate *)eventTime {
    if (!_eventTime) {
        _eventTime = [NSDate date];
    }
    
    return _eventTime;
}

#pragma mark --
#pragma mark -  NSCoding
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super init];
    if (self) {
        self.ID = [aDecoder decodeObjectForKey:@"ID"];
        self.appID = [aDecoder decodeObjectForKey:@"appID"];
        self.userID = [aDecoder decodeObjectForKey:@"userID"];
        self.logLot = [aDecoder decodeObjectForKey:@"logLot"];
        self.loginType = [aDecoder decodeObjectForKey:@"loginType"];
        self.loginTime = [aDecoder decodeObjectForKey:@"loginTime"];
        self.eventType = [aDecoder decodeObjectForKey:@"eventType"];
        self.eventName = [aDecoder decodeObjectForKey:@"eventName"];
        self.eventData = [aDecoder decodeObjectForKey:@"eventData"];
        self.eventTime = [aDecoder decodeObjectForKey:@"eventTime"];
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder {
    [aCoder encodeObject:self.ID forKey:@"ID"];
    [aCoder encodeObject:self.appID forKey:@"appID"];
    [aCoder encodeObject:self.userID forKey:@"userID"];
    [aCoder encodeObject:self.logLot forKey:@"logLot"];
    [aCoder encodeObject:self.loginType forKey:@"loginType"];
    [aCoder encodeObject:self.loginTime forKey:@"loginTime"];
    [aCoder encodeObject:self.eventType forKey:@"eventType"];
    [aCoder encodeObject:self.eventName forKey:@"eventName"];
    [aCoder encodeObject:self.eventData forKey:@"eventData"];
    [aCoder encodeObject:self.eventTime forKey:@"eventTime"];
}

@end
